package com.futures.questionbank.adapter;

import android.content.Context;

import com.futures.questionbank.R;
import com.futures.questionbank.db.table.chapter;

import java.util.List;

public class ChapterAdpter extends BaseRecycleAdapter<chapter> {
    private List<chapter> dataList;
    private Context mContext;
    private BaseViewHolder.onItemCommonClickListener commonClickListener;



    public ChapterAdpter(Context context, List<chapter> dataList, BaseViewHolder.onItemCommonClickListener commonClickListener) {
        super(context, dataList, R.layout.itme_chapter_list3);
        this.dataList = dataList;
        this.commonClickListener = commonClickListener;
        mContext = context;
    }

    @Override
    public void bindData(BaseViewHolder holder, chapter data) {
        holder.setText(R.id.tv, data.getTitle()).setCommonClickListener(commonClickListener);
        if (holder.getAdapterPosition() == 0){
            holder.setText(R.id.tv2, "共3节").setCommonClickListener(commonClickListener);
        }else if (holder.getAdapterPosition() == 1){
            holder.setText(R.id.tv2, "共4节").setCommonClickListener(commonClickListener);
        }else if (holder.getAdapterPosition() == 2){
            holder.setText(R.id.tv2, "共3节").setCommonClickListener(commonClickListener);
        }else if (holder.getAdapterPosition() == 3){
            holder.setText(R.id.tv2, "共3节").setCommonClickListener(commonClickListener);
        }else if (holder.getAdapterPosition() == 4){
            holder.setText(R.id.tv2, "共4节").setCommonClickListener(commonClickListener);
        }else if (holder.getAdapterPosition() == 5){
            holder.setText(R.id.tv2, "共3节").setCommonClickListener(commonClickListener);
        }else if (holder.getAdapterPosition() == 6){
            holder.setText(R.id.tv2, "共4节").setCommonClickListener(commonClickListener);
        }else if (holder.getAdapterPosition() == 7){
            holder.setText(R.id.tv2, "共3节").setCommonClickListener(commonClickListener);
        }else if (holder.getAdapterPosition() == 8){
            holder.setText(R.id.tv2, "共4节").setCommonClickListener(commonClickListener);
        }else {
            holder.setText(R.id.tv2, "共3节").setCommonClickListener(commonClickListener);
        }
    }
}
